{extend name="admin@index_layout"/}
{block name="main"}
<!--<style type="text/css">-->
<!--    .layui-table-cell{-->
<!--        height: auto!important;-->
<!--        white-space: normal;-->
<!--    }-->
<!--</style>-->

<div class="layui-card">
    <div class="layui-card-header">我的团队</div>
    <div class="layui-card-body">
        <table class="layui-hide" id="currentTable" lay-filter="currentTable"
               data-auth-add="{:$auth->check('member2.member/add')}"
               data-auth-edit="{:$auth->check('member2.member/edit')}"
               data-auth-delete="{:$auth->check('member2.member/del')}"
        ></table>
    </div>
</div>

<script type="text/html" id="picTpl">

    <img style="max-Width:80px; max-height:30px;" src="{{d.avatarUrl}}" data-image="{{d.nickname}}">

</script>

<script type="text/html" id="barTool">
    <a class="layui-btn layui-btn-xs " data-open='{:url("team")}?id={{ d.id }}' data-title="我的团队"
       data-full="true">我的团队</a>
    <a class="layui-btn layui-btn-xs " data-open='{:url("yejic")}?id={{ d.id }}' data-title="每月业绩"
       data-full="true">每月业绩</a>

    <a class="layui-btn layui-btn-xs layui-btn-normal" data-open='{:url("recharge")}?id={{ d.id }}' data-title="增加线下业绩"
    >增加线下业绩</a>
<!--    <a data-open='{:url("chargelist")}?member_id={{d.id }}'-->
<!--       class="layui-btn layui-btn-xs layui-btn-warm"-->
<!--       title="充值记录">线下业绩记录</a>-->
</script>

<!--操作模板-->

{/block}
{block name="script"}


<script>
    layui.use('yznTable', function() {
        var table = layui.yznTable;
        var init = {
            table_elem: '#currentTable',
            table_render_id: 'currentTable',
            add_url: "{:url('add')}",
            edit_url: "{:url('edit')}",
            delete_url: "{:url('del')}",
        };

        table.render({
            init: init,
            autowidth: true,
            search:false,
            // toolbar: ['refresh','add','delete'],
            toolbar: ['refresh'],
            url: '{:url("team")}?member_id={$member_id}',
            cols: [
                [
                    { type: 'checkbox', fixed: 'left' },
                    { field: 'id', width: '10%', fixed: 'left',align: "center", title: 'ID'},
                    { field: 'nickname', width: '20%', align: "center",title: '昵称',searchOp: 'like'},
                    { field: 'level.name', width: '18%', align: "center",title: '会员等级',search: false},
                    { field: 'avatarUrl', width: '10%', align: "center",title: '图片', search: false, templet: '#picTpl' },
                    { field: 'mobile', width: '20%',align: "center", title: '手机号',},
                    { field: 'team_num', width: '8%',align: "center", title: '团队人数',search: false},
                    // { field: 'yeji2', width: '8%',align: "center", title: '线上消费',search: false},
                    // { field: 'cyeji', width: '8%',align: "center", title: '线下消费',search: false},
                    { field: 'zong_yeji', width: '10%',align: "center", title: '订单金额',search: false},
                    // { field: 'fraction', width: '6%',align: "center", title: '积分',search: false},
                    // { field: 'reg_ip', width: '10%',align: "center", title: '注册ip',search: false },
                    // { field: 'create_time',align: "center", width: '15%', title: '创建时间',search: 'range' },
                    // { fixed: 'right',align: 'center',width:'25%', title: '操作',toolbar: '#barTool' }//delete'
                ]
            ],
            page: {}
        });
        yznTable.bindevent();
        selectElement2 = document.getElementById('searchFieldset_currentTable');
        selectElement2.classList.remove("layui-hide");
    });
</script>
{/block}